﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Threading;
using System.Diagnostics;

using Styx;
using Styx.Combat.CombatRoutine;
using Styx.Helpers;
using Styx.Logic;
using Styx.Logic.BehaviorTree;
using Styx.Logic.Combat;
using Styx.Logic.Pathing;
using Styx.Logic.POI;
using Styx.WoWInternals.WoWObjects;
using TreeSharp;
using Action = TreeSharp.Action;
using Sequence = TreeSharp.Sequence;
using Styx.WoWInternals;

namespace Healz.Druid.Spells
{
    public static class Lifebloom
    {
        public const string SpellName = "Lifebloom";

        public static bool Pulse(WoWPlayer Player)
        {
            // Our checks
            if (Player.HealthPercent > Main.cSettings.Lifebloom_Percent) return false;
            if (Player.Distance2D > SpellManager.Spells[SpellName].MaxRange) return false;
            if (!SpellManager.Spells[SpellName].CanCast) return false;

            
            if (MySpellManager.HasMyAura(Player, SpellName))
            {
                if (Player.ActiveAuras[SpellName].StackCount >= 3) return false;
            }


            Utils.WriteCast(SpellName, Player);
            SpellManager.Cast(SpellName, Player);
            return true;
        }


    }
}
